<div class="admin-sidebar am-offcanvas" id="admin-offcanvas">
    <div class="am-offcanvas-bar admin-offcanvas-bar">
        <ul class="am-list admin-sidebar-list">
            <li><a href="{:url('admin/index/index')}"><span class="am-icon-home"></span> 首页</a></li>
            <li class="admin-parent">
                <a class="am-cf" onclick="expand('sidebar')">
                    <span class="am-icon-sitemap"></span> 站点管理
                    <span class="am-icon-angle-down am-fr am-margin-right"></span>
                </a>
                <ul class="am-list am-collapse admin-sidebar-sub {eq name=" @$page.path " value="site "}am-in{/eq}" id="childsidebar" style="display: none">
                    <li><a href="{:url('admin/site/config')}"><span class="am-icon-bug"></span> 站点配置</a></li>
                    <li><a href="{:url('admin/site/log')}"><span class="am-icon-calendar"></span> 系统日志</a></li>
                </ul>
            </li>
            <li class="admin-parent">
                <a class="am-cf" onclick="expand('rbac')">
                    <span class="am-icon-sitemap"></span> 权限管理
                    <span class="am-icon-angle-down am-fr am-margin-right"></span>
                </a>
                <ul class="am-list am-collapse admin-sidebar-sub {eq name=" @$page.path " value="site "}am-in{/eq}" id="childrbac" style="display: none">
                    <li><a href="{:url('admin/rbac/getRoleList')}"><span class="am-icon-bug"></span>角色管理</a></li>
                    <li><a href="{:url('admin/rbac/getRule')}"><span class="am-icon-calendar"></span>权限管理</a></li>
                </ul>
            </li>
            <li>
                <a href="{:url('admin/category/list')}">
                    <span class="am-icon-th-large"></span> 分类管理
                </a>
            </li>
            <li>
                <a href="{:url('admin/users/list')}">
                    <span class="am-icon-users"></span> 用户管理
                    <span class="am-badge am-badge-danger am-margin-right am-margin-top-xs am-fr" id="number0"></span>
                </a>
            </li>
            <li>
                <a href="{:url('admin/goods/list')}">
                    <span class="am-icon-shopping-cart"></span> 二手货管理
                    <span class="am-badge am-badge-danger am-margin-right am-margin-top-xs am-fr" id="number1"></span>
                </a>
            </li>
            <li>
                <a href="{:url('admin/feedback/list')}">
                    <span class="am-icon-pencil-square-o"></span> 留言管理
                    <span class="am-badge am-badge-danger am-margin-right am-margin-top-xs am-fr" id="number2"></span>
                </a>
            </li>
            <li>
                <a href="{:url('admin/index/help')}">
                    <span class="am-icon-question"></span> 帮助页
                </a>
            </li>
        </ul>
        <div class="am-panel am-panel-default admin-sidebar-panel">
            <div class="am-panel-bd">
                <p><span class="am-icon-bookmark"></span> 公告</p>
                <p>
                    <!-- 公告从配置文件中获取 -->
                </p>
            </div>
        </div>
        <div class="am-panel am-panel-default admin-sidebar-panel">
            <div class="am-panel-bd">
                <p><span class="am-icon-tag"></span> wiki</p>
                <p>Welcome to TianYou Market !</p>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
function expand(el) {
    childobj = document.getElementById("child" + el);

    if (childobj.style.display == 'none') {
        childobj.style.display = 'block';
        document.cookie = "index_" + el + "=block";
    } else {
        childobj.style.display = 'none';
        document.cookie = "index_" + el + "=none";
    }
    return;
}

function getCookie(name) {
    var strCookie = document.cookie;
    var arrCookie = strCookie.split("; ");
    for (var i = 0; i < arrCookie.length; i++) {
        var arr = arrCookie[i].split("=");
        if (arr[0] == name)
            return arr[1];
    }
    return false;
}

if (s = getCookie('index_sidebar')) {
    childobj = document.getElementById("childsidebar");
    childobj.style.display = s;
}

$(document).ready(function s () {
    $.post("{:url('admin/number/number')}",function(data){
        $('#number0').text(data['users_number']);
        $('#number1').text(data['goods_number']);
        $('#number2').text(data['msg_number']);
    });
})
</script>